﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Dovey.Framework
{
    public static class ConsoleExtend
    {
        public static void Show<T>(this T t)
        {
            Type type = typeof(T);
            Console.WriteLine($"**********{type.Name} Show Start ******************");
            foreach (var prop in type.GetProperties())
            {
                Console.WriteLine($"    {prop.Name}:{prop.GetValue(t)}");
            }
            Console.WriteLine($"***********{type.Name} Show End ************************");
        }
        public static void ShowList<T>(this IEnumerable<T> t)
        {
            Console.WriteLine($"######### ShowList Start #########");
            foreach (T item in t)
            {
                Type type = typeof(T);
                Console.WriteLine($"**********{type.Name} Show Start ******************");
                foreach (var prop in type.GetProperties())
                {
                    Console.WriteLine($"    {prop.Name}:{prop.GetValue(item)}");
                }
                Console.WriteLine($"***********{type.Name} Show End ************************");
            }
            Console.WriteLine($"######## Show List End #########");

        }
    }
}
